#include <stdio.h>
/*
* I_1.c
*
*  Created on: April, 23, 2009
*      Author: yimingliu@fudan.edu.cn
*/
#define N 16
typedef struct
{
	char num[10];
	int s;
} STREC;

int funI_1_fun(STREC *a, STREC *b)
{
	int i,j=0,n=0,min;
	min=a[0].s;
	for(i=0;i<N;i++)
		if(min>a[i].s)
			min=a[i].s;
	for(i=0;i<N;i++)
		if(a[i].s==min)
		{
			*(&b[j])=a[i];
			j++;
			n++;
		}
	return n;
}

void funI_1()
{
	STREC s[N]={{"GA05",85},{"GA03",76},{"GA02",69},
	            {"GA04",85},{"GA01",91},{"GA07",72},
	            {"GA08",64},{"GA06",87},{"GA015",85},
	            {"GA013",91},{"GA012",64},{"GA014",91},
	            {"GA011",91},{"GA017",64},{"GA018",64},
	            {"GA016",72}};
	STREC h[N];
	int i,n;
	FILE *out;
	n=funI_1_fun(s,h);
	printf("The %d lowest score: \n",n);
	for(i=0;i<n;i++)
		printf("%s %4d\n",h[i].num,h[i].s);
	printf("\n");
	out=fopen("out14.data","w");
	fprintf(out,"%d\n",n);
	for(i=0;i<n;i++)
		fprintf(out,"%4d\n",h[i].s);
	fclose(out);
}